﻿using System;
using System.Collections.Generic;
using System.Text;
using DTO;
using System.Data.SqlClient;
using System.Data;

namespace DAO
{
    public class THONGKEHANHKHACH_DAO
    {

        public static List<THONGKEHANHKHACH_DTO> SelectThongKeHanhKhach(int maTuyen)
        {
            List<THONGKEHANHKHACH_DTO> list = new List<THONGKEHANHKHACH_DTO>();
            try
            {
                List<SqlParameter> sqlParams = new List<SqlParameter>();
                sqlParams.Add(new SqlParameter("@MaTuyenDL", maTuyen));
                DataTable dt = SqlDataAccessHelper.ExecuteQuery("SelectThongKeHanhKhachByMaTuyen", sqlParams);
                foreach (DataRow dr in dt.Rows)
                {
                    THONGKEHANHKHACH_DTO tk = new THONGKEHANHKHACH_DTO();
                    tk.MaTuyenDL = int.Parse(dr["MaTuyenDL"].ToString());
                    tk.MaChuyenDL = int.Parse(dr["MaChuyenDL"].ToString());
                    tk.MaKH = dr["MaKH"].ToString();
                    list.Add(tk);
                }
            }
            catch (Exception ex)
            {
                throw ex;
            }
            return list;
        }
        //public static List<THONGKEHANHKHACH_DTO> SelectThongKeHanhKhachsAll()
        //{
        //    List<THONGKEHANHKHACH_DTO> list = new List<THONGKEHANHKHACH_DTO>();
        //    try
        //    {
        //        DataTable dt = SqlDataAccessHelper.ExecuteQuery("SelectThongKeHanhKhachsAll");
        //        foreach (DataRow dr in dt.Rows)
        //        {
        //            THONGKEHANHKHACH_DTO tdl = new THONGKEHANHKHACH_DTO();
        //            tdl.MaTuyen = int.Parse(dr["MaTuyenDL"].ToString());
        //            tdl.TenChuyen = dr["MaChuyenDL"].ToString();
        //            tdl.MaHK = dr["MaKH"].ToString();

        //            list.Add(tdl);
        //        }
        //    }
        //    catch (Exception ex)
        //    {
        //        throw ex;
        //    }
        //    return list;
        //}
    }
}
